#include <iostream>
#include <list>
#include <vector>
using namespace std;

typedef struct
{
    string color;
    int cnt;
} unit;

int main()
{
    int n, times;
    vector<unit> output;
    while(cin >> n && n!=0)
    {
        ++times;
        list<unit> balllist;
        list<unit>::iterator it = balllist.begin();
        string color;
        cin >> color;
        unit ball;
        ball.color = color;
        ball.cnt = 1;
        balllist.push_back(ball);
        for(int i=1; i<n; i++)
        {
            cin >> color;
            it = balllist.begin();
            //Find
            while (it!=balllist.end())
            {
                if((*it).color!=color) ++it;
                else break;
            }

            if(it!=balllist.end()) ++(*it).cnt;
            else
            {
                unit ball;
                ball.color = color;
                ball.cnt = 1;
                balllist.push_back(ball);
            }
        }
        it = balllist.begin();
        unit maxball = *it;
        for(; it!=balllist.end(); ++it)
            if((*it).cnt > maxball.cnt) maxball = *it;
        output.push_back(maxball);
    }
    for(int i=0; i<output.size(); ++i)
        cout << output[i].color << endl;
    return 0;
}
